<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	
	<head>
		<meta charset="utf-8" />
		<title>后台管理系统</title>

		<meta name="description" content="data tables" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="shortcut icon" href="/Public/assets/img/favicon.png" type="image/x-icon">

		<!--Basic Styles-->
		<link href="/Public/assets/css/bootstrap.min.css" rel="stylesheet" />
		<link id="bootstrap-rtl-link" href="#" rel="stylesheet" />
		<link href="/Public/assets/css/font-awesome.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/weather-icons.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/ladda-themeless.min.css" rel="stylesheet" />

		<!--Fonts-->

		<!--Beyond styles-->
		<link id="beyond-link" href="/Public/assets/css/beyond.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/demo.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/typicons.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/animate.min.css" rel="stylesheet" />
		<link href="/Public/assets/css/dataTables.bootstrap.css" rel="stylesheet" />
		<style type="text/css">
			.page-content {
				margin-left: 0;
			}
		</style>
		<script src="/Public/assets/js/jquery.min.js"></script>
		
	<style>
		.bootbox-body img {
			max-width: 100%!important;
		}
	</style>


		
	</head>
	<!-- /Head -->
	<!-- Body -->

	<body>
		
		
		
	<div class="page-content">
		<div class="page-breadcrumbs">
			<ul class="breadcrumb">
				<li>
					<i class="fa fa-home"></i>
					<a href="<?php echo U('dashboard/index');?>">系统首页</a>
				</li>
				<li>
					<a href="javascript:;">消息管理</a>
				</li>
				<li class="active">消息列表</li>
			</ul>
		</div>

		<div class="page-body">
			<div class="row">
				<div class="col-lg-12 col-sm-12 col-xs-12">
					<div class="widget">
						<div class="widget-header bordered-left bordered-darkorange">
							<span class="widget-caption">消息查找</span>
							<div class="widget-buttons">

								<a href="#" data-toggle="collapse">
									<i class="fa fa-minus"></i>
								</a>
								<a href="#" data-toggle="dispose">
									<i class="fa fa-times"></i>
								</a>
							</div>
						</div>
						<div class="widget-body bordered-left bordered-warning">
							<form class="form-inline" role="form">								
								<div class="form-group">
									<input type="text" class="form-control" name="keyword" placeholder="消息标题" value="<?php echo ($_REQUEST['keyword']); ?>">
								</div>

								<button type="submit" class="btn btn-default">搜索</button>

								<a href="<?php echo U('Message/send');?>" class="btn btn-darkorange pull-right">
									<i class="fa fa-plus"></i> 发送系统消息
								</a>
							</form>

						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-12 col-md-12">
					<form method="post" id="listForm">
						<table class="table table-hover">
							<thead>
								<tr>
									<th class="text-center" width="80">
										<label>
											<input type="checkbox" class="colored-success select-all">
											<span class="text"></span>
										</label>
									</th>
									<th class="text-center" width="80">ID</th>
									<th class="text-center" width="80">用户</th>
									<th>标题</th>
									<th class="text-center" width="250">发布时间</th>
									<th class="text-center" width="200">操作</th>
								</tr>
							</thead>
							<?php if(is_array($messages)): $i = 0; $__LIST__ = $messages;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$val): $mod = ($i % 2 );++$i;?><tr>

									<td class="text-center">
										<label>
											<input type="checkbox" name="id[<?php echo ($val["id"]); ?>]" value="<?php echo ($val["id"]); ?>" class="colored-success select-item">
											<span class="text"></span>
										</label>
									</td>									
									<td class="text-center"><?php echo ($val["id"]); ?></td>
									<td class="text-center"><?php echo ((isset($val["nickname"]) && ($val["nickname"] !== ""))?($val["nickname"]):'---'); ?></td>
									<td><?php echo ($val["title"]); ?></td>
									<td class="text-center"><?php echo (format_time($val["created_at"])); ?></td>
									<td class="text-center">
										<a href="<?php echo U('Message/view?id='.$val['id']);?>" class="btn btn-default btn-xs"><i class="fa  fa-eye"></i>查看</a>
										<a href="<?php echo U('Message/delete',['id'=>$val['id']]);?>" class="btn btn-danger btn-xs white" data-confirm="确定删除该消息?"><i class="fa fa-trash-o"></i>删除</a>

									</td>

								</tr><?php endforeach; endif; else: echo "" ;endif; ?>
							<tbody>
							</tbody>
						</table>
						<div class="row DTTTFooter">
							<div class="col-sm-6">
								<div class="dataTables_info" id="simpledatatable_info" role="status" aria-live="polite">
									<div class="buttons-preview">
										<a href="javascript:void(0);" class="btn btn-danger shiny" id="delete"  data-action="<?php echo U('Message/delete');?>" data-confirmtext="确定删除已选中的消息？">删除</a>
									</div>
								</div>
							</div>
							<div class="col-sm-6">
								<div class="dataTables_paginate paging_bootstrap" id="simpledatatable_paginate">
									<?php echo ($page); ?>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>

		</div>
	</div>

				<!--Basic Scripts-->
		
		<script src="/Public/assets/js/bootstrap.min.js"></script>
		<script src="/Public/assets/js/slimscroll/jquery.slimscroll.min.js"></script>
		<script src="/Public/assets/js/fuelux/spinbox/fuelux.spinbox.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/Public/assets/js/loading/spin.js" type="text/javascript" charset="utf-8"></script>
		<script src="/Public/assets/js/loading/ladda.js" type="text/javascript" charset="utf-8"></script>
		<script src="/Public//assets/js/bootstrap-modalmanager.js" type="text/javascript" charset="utf-8"></script>
		<!--Beyond Scripts-->
		<script src="/Public/assets/js/beyond.js"></script>
		<script src="/Public/assets/js/toastr/toastr.js"></script>
		<script src="/Public/assets/js/bootbox/bootbox.js"></script>
		<script src="/Public/assets/js/common.js"></script>
		
	<script src="/Public/assets/js/jquery.form.js" type="text/javascript" charset="utf-8"></script>

	<script type="text/javascript">
		function checkCount() {
			return $(".select-item:checked").length;
		}
		$("#sort,#delete,#move a").click(function() {
			var action = $(this).data("action");
			if(!action) return false;
			if (!checkCount()) {
				tips('请选择要操作的数据', 'danger');
				return false;
			}			
			var confirmText = $(this).data("confirmtext");
			if(confirmText){ 
				bootbox.confirm(confirmText,function(flag){ 
					if(flag){ 
						$("#listForm").attr("action",action).ajaxSubmit(function(result) {
							result = JSON.parse(result);
							if (result.status == 'success') {
								location.reload();
							} else {
								tips(result.message, 'danger');
							}
						});
					}
				})
			}else{ 
				$("#listForm").attr("action",action).ajaxSubmit(function(result) {
							result = JSON.parse(result);
							if (result.status == 'success') {
								location.reload();
							} else {
								tips(result.message, 'danger');
							}
						});
			}
			
		});
	</script>



	</body>
	<!--  /Body -->
	<script>
		 <?php if (!IS_AJAX) { $success_message = session('__SUCCESS_MESSAGE'); if ($success_message) { echo "tips('".$success_message. "');"; } session('__SUCCESS_MESSAGE', null); $error_message = session('__ERROR_MESSAGE'); if ($error_message) { echo "tips('".$error_message. "','danger');"; } session('__ERROR_MESSAGE', null); } ?>
	
	if(parent && typeof parent._attachEvent == 'function'){
		parent._attachEvent(document.documentElement, 'keydown', parent.resetF5);
	}
	</script>

</html>